#coding-utf-8
import unittest
from global_utils.runmodeconfig import RUNMODECONFIG
from global_utils.parser_ws_config import WSCONFIG
from get_case.get_test_case import TestCase
from case_runner.build_case import InterfaceTestCase


sql="insert into `result`(`result_name`)values('%s')" %(RUNMODECONFIG.result_name)
WSCONFIG.get_db_conn.execute(sql)
suite = unittest.TestSuite()

if  RUNMODECONFIG.get_run_mode=="3":
    case_id_list=RUNMODECONFIG.case_id_list
    for id in case_id_list:
        case_info = TestCase(id).get_case
        case=InterfaceTestCase(case_info)
        suite.addTest(case)

print suite.countTestCases()
runner=unittest.TextTestRunner()
runner.run(suite)
